//  SRT


SRTSubtitleDecoder = function () {

}

SRTSubtitleDecoder.prototype = new SubtitleDecoder();

SRTSubtitleDecoder.prototype.canDecode = function (fileType) {
    if (fileType == "srt")
        return true;
    else
        return false;
};

SRTSubtitleDecoder.prototype.getSubtitleTime = function (string) {
    var time = new Array();
    var startTime = string.substr(0, 8);
    var endTime = string.substr(17, 8);
    time[0] = this.getSecondFromTimeString(startTime);
    time[1] = this.getSecondFromTimeString(endTime);
    return time;
};

SRTSubtitleDecoder.prototype.decodeString = function (string) {
    var arr = string.split("|||");
    var i;
    var linePosition = 1;
    var time = new Array();
    for (i = 0; i < arr.length; i+=4) {
		//jso.logd("index", i + "");
		try{
			time = this.getSubtitleTime(arr[i+1]);
			this.subtitleArray[i/4] = new SubtitleEntry(time[0], time[1], arr[i+2]);
		}
		catch(e){
			this.subtitleArray[i/4] = this.subtitleArray[i/4-1];
		}
    }
	return this.subtitleArray;
};